package com.cms.plugin.services;

import com.cms.common.model.entity.Plugin;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import java.util.List;
import java.util.Map;

public interface PluginService {
    List<Plugin> findAll();
    
    Plugin findById(Long id);
    
    Plugin findByPackageName(String packageName);
    
    Plugin save(Plugin plugin);
    
    void delete(Long id);
    
    // 插件特定方法

    boolean install(String pluginId) throws Exception;

    boolean uninstall(String pluginId) throws Exception;
    
    void enable(String pluginId) throws Exception;
    
    void disable(String pluginId) throws Exception;
    
    void updateConfig(Long id, Map<String, Object> config) throws Exception;
    
    // 获取插件市场的可用插件列表
    Page<Plugin> getMarketPlugins(PageRequest pageRequest);

    Plugin findByPluginId(String pluginId);

    void init(Plugin plugins);
} 